import { RouteObject } from "./router.types";
//匹配路由信息
export const matchRoute = (pathname: string, routes: RouteObject[] = []): RouteObject => {
    let result = {};
    for(let item of routes){
        if(item.path==pathname){
            return item;
        }
        if(item.children?.length){
            const res = matchRoute(pathname,item.children);
            if(Object.keys(res).length){
                return res;
            }
        }
    }
    return result;
}